@ECHO OFF
CALL FindJDK.bat
SET cc=javac
SET cflags=-nowarn -Xlint:deprecation -Xlint:none
SET out=out
SET bin=rs.jar
SET quiet=0
IF "%1"=="/F" (
	SET quiet=1
	GOTO :scripts
)
IF "%1"=="/Q" SET quiet=1

ECHO Compiling Bot
SET lstf=_jlist.txt
IF EXIST %lstf% DEL /F /Q %lstf%
FOR /F "usebackq tokens=*" %%G IN (`DIR /B /S Bot\*.java`) DO CALL :append "%%G"
IF EXIST %out% RMDIR /S /Q %out% > NUL
MKDIR %out%
%cc% %cflags% -cp %bin% -d %out% "@%lstf%"
DEL /F /Q "%lstf%"

CALL :compset Randoms
CALL :compset AntiBan

:scripts
CALL :compset Scripts
XCOPY /B /Y Scripts\Precompiled\*.class Scripts\*.class 2>NUL

ECHO Compilation successful, click play or play-free to start!
IF "%quiet%"=="0" CALL Play.bat /N
GOTO :eof

:append
SET gx=%1
SET gx=%gx:\=\\%
ECHO %gx% >> %lstf%
GOTO :eof

:compset
ECHO Compiling %1
ECHO. > %1\.class
DEL /F /Q %1\*.class > NUL
%cc% %cflags% -cp "%out%;%bin%" %1\*.java > NUL
GOTO :eof